switchroot: Properly check for number of arguments
authorAdrian Perez <aperez@igalia.com>
Wed, 18 Apr 2012 18:13:43 +0000 (21:13 +0300)
committerColin Walters <walters@verbum.org>
Wed, 18 Apr 2012 19:20:46 +0000 (15:20 -0400)
The ostree-switch-root tool expects three arguments (argc=4): new root, OS
tree target, and init(8) binary to launch inside it. Also, the error message
when not enough arguments are passed now tells about the second argument
being the target OS tree.

Reviewed-by: Colin Walters <walters@verbum.org>
src/switchroot/ostree-switch-root.c

index 60306e6c347c746cbd2f7c62a100679c467a7a7a..c96ed3b41ed061d0c3af97a3f231482ecd7a5759 100644 (file)
@@ -168,9 +168,9 @@ main(int argc, char *argv[])
   int before_init_argc = 0;
   pid_t cleanup_pid;
 
-  if (argc < 3)
+  if (argc < 4)
     {
-      fprintf (stderr, "usage: ostree-switch-root NEWROOT INIT [ARGS...]\n");
+      fprintf (stderr, "usage: ostree-switch-root NEWROOT TARGET INIT [ARGS...]\n");
       exit (1);
     }